#include "declarari.h"



void Singleton::ProceseazaClienti()
{
char cmd='a';

while(cmd!='x')
{
char nume[40],culoare[20],transmisie[20];
int varsta;
cout<<"\nIntroduceti numele si varsta:\n";
cin>>nume;
cin>>varsta;

cout<<"\nIntroduceti culoarea si transmisia:\n";
cin>>culoare;
cin>>transmisie;

Client c(nume,varsta);
c.addArticol(culoare, transmisie, "clima","6AirBag", "TouchScreen"); 
c.addArticol(culoare, transmisie, 5,1,float(1.9));
c.addArticol(culoare, transmisie, float( 1.5),"AC",0);


cout<<"\nAcestea sunt variantele posibile pentru masina dumneavoastra:\n";
c.Print();

cout<<"\n Apasati x pentru iesire sau orice alta tasta pentru a introduce alt client\n";
cin>>cmd;


}

}
	

void Singleton::Exemplu()
{
Client m1 ("Radu",23);
m1.addArticol("Alb", "Manuala", "clima","6AirBag", "TouchScreen"); 
m1.addArticol("Albastru", "Manuala", 5,1,float(1.9));
m1.addArticol("Roz", "Automata", float( 1.5),"AC",0);

m1.Print ();
cout<<endl;

Client m2 ("Ion",40);
m2.addArticol("Alb", "Manuala", "biclimatronic","10AirBarg","Casetofon"); 
m2.addArticol("Negru", "Manuala", float( 2.0),"AC",1);
m2.addArticol("Albastru", "Manuala", 3,0,float(1.2));
m2.addArticol("Rosu", "Manuala", "bizonica","2 AirBag","RadioCD");
m2.Print();
cout<<endl;

}

bool Singleton::instanceFlag = false;
Singleton* Singleton::single = NULL;
Singleton* Singleton::getInstance()
{
    if(! instanceFlag)
    {
        single = new Singleton();
        instanceFlag = true;
        return single;
    }
    else
    {
        return single;
    }
}
void Client::addArticol (char *culoare, char* transmisie, char *clima, char *securitate, char *divert)
	{sedan *aux=new sedan(culoare,transmisie,clima,securitate,divert);
	if(head==NULL)
	{   
	    head=new nod;
		head->p=aux;head->next=NULL;
    }
	else 
	{lista aux1;
	aux1=new nod;
	aux1->p=aux;
	aux1->next=head;
	head=aux1;}
	
	}

void Client::addArticol (char *culoare,char* transmisie,int g,int a,float c)
	{coupe *aux=new coupe(culoare,transmisie,g,a,c);
	if(head==NULL)
	{   
	    head=new nod;
		head->p=aux;
		head->next=NULL;
    }
	else 
	{lista aux1;
	aux1=new nod;
	aux1->p=aux;
	aux1->next=head;
	head=aux1;}
	
	}


void Client::addArticol (char *culoare,char* transmisie,float g,char *c,int t)
	{mini *aux=new mini(culoare,transmisie,g,c,t);
	if(head==NULL)
	{   
	    head=new nod;
		head->p=aux;
		head->next=NULL;
    }
	else 
	{lista aux1;
	aux1=new nod;
	aux1->p=aux;
	aux1->next=head;
	head=aux1;}
	
	}

void Client::Print()
{cout<<name<<" cu varsta "<<varsta<<"\n";
lista m;
for(m=head;m;m=m->next)
{m->p->tip();cout<<"  ";
m->p->PrintProductInfo();}



}